home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-10-04 | 3.0 KB | 103 lines |
- package sub_arctic.test;
-
- import sub_arctic.input.*;
- import sub_arctic.lib.*;
- import sub_arctic.output.*;
- import sub_arctic.constraints.std_function;
-
- public class frame_test extends interactor_applet implements callback_object
- {
- button show_button;
- button hide_button;
- interactor_frame iframe;
-
- /**
- * This is the build_ui method for the APPLET
- */
- public void build_ui(base_parent_interactor top) {
- /* put a button in */
- show_button=new button(0,0,"Push Me", this);
- top.add_child(show_button);
- /* center the button */
- top.child(0).set_x_constraint(std_function.centered(PARENT.X2(), 0));
- top.child(0).set_y_constraint(std_function.centered(PARENT.Y2(), 0));
- }
- /**
- * This gets called if we get uniconified, so we need to put the
- * frame back on the screen.
- */
- public void start() {
- if (iframe!=null) {
- iframe.show();
- }
- }
- /**
- * You get a call to stop if the browser gets iconified. We take
- * the window off the screen.
- */
- public void stop() {
- if (iframe!=null) {
- iframe.hide();
- }
- }
- /**
- * Create the extra frame.
- */
- public void newFrame() {
- /* if we already have a frame, don't need another one */
- if (iframe!=null) {
- return;
- }
- /* make a new toplevel... the size will get overriden with
- * constraints */
- top_level tl=new top_level();
- /* put the button at 10, 10 and use 10 and 10 as the border sizes */
- hide_button=new button(10,10,"Push Me Too!", this);
- tl.add_child(hide_button);
- /* set constraints on the tl size .. we add the constants to
- compensate for AWT brain damage */
- tl.set_h_constraint(std_function.offset(MAX_CHILD.Y2(), 35));
- tl.set_w_constraint(std_function.offset(MAX_CHILD.X2(), 25));
- iframe=new interactor_frame("Test Frame", tl);
- /* if you called "setResizable() on iframe here you could force it
- * to never get bigger */
- iframe.set_callback_obj(this);
- iframe.show();
- }
- /**
- * Called when they press the button
- */
- public void callback(interactor from_obj, event evt, int callback_num,
- Object callback_info) {
- /* figure out who sent this */
- if (from_obj==show_button) {
- newFrame();
- } else {
- /* is it the user hitting the hide button? */
- if (from_obj==hide_button) {
- iframe.hide();
- iframe=null;
- } else {
- /* must be the top level telling use the user killed us */
- iframe=null;
- }
- }
- }
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-